A cache remembers function values, f(x) = y, so that function evaluations can avoid lengthy recomputations. Each cache has a finite capacity. When a new value is added to the cache, the cache discards the value that has gone unused for the longest period of time. It uses a callback function to alert the application that a value is being discarded. In this way memory can be freed and reclaimed for other uses.